//继承类调用父类的构造函数
//派生类覆盖基类
//
#include <iostream>
#include <string>
using namespace std;

class Fish
{
public:
    virtual void swim(void)
    {
        cout << "Fish swim!" << endl;
    }
//让Fish参数表现出其实际类型的行为, 可将Fish::swim()声明为虚函数 virtual 确保编译器调用覆盖版本
    //虚构函数可以确保编译器调用类的覆盖版本
   void MakeFishSwim(Fish& inputFish)
    {
        inputFish.swim();
    }
};

class Tuna:public Fish
{
public:
    void swim(void)
    {
        cout << "Tuna swim" << endl;
    }
};

int main()
{
    Tuna mytuna;
    mytuna.swim();
    mytuna.MakeFishSwim(mytuna);
    return 0;
}
